package view_parameter;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Font;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.TableColumn;

import model.AnzeigeModel;
import controler.Controler;
import datenbank.ModelStat2;
import font.Schriften;

public class Station2 extends JPanel {
	
	private AnzeigeModel anzeigeModel;
	private Controler controler;
	private JLabel lblTitel;
	private ModelStat2 modelStat;
	private JTable table;
	private JScrollPane scrollPane;
	private TableColumn col;

	/**
	 * Konstruktor
	 * 
	 * @param anzeigeModel
	 * @param controler
	 * @param modelStat2
	 */
	public Station2(AnzeigeModel anzeigeModel, Controler controler, ModelStat2 modelStat) {
		super(new BorderLayout(10, 10));

		this.anzeigeModel = anzeigeModel;
		this.controler = controler;

		this.modelStat = modelStat;

		initTable();

		initWidgets();

		addWidgets();
	}

	private void initTable() {
		table = new JTable(modelStat);

		table.getTableHeader().setFont(new Font("SansSerif", 1, 16));

		table.setRowHeight(20);
		table.setFont(new Font("SansSerif", 0, 14));

		table.setAutoResizeMode(0);

		col = table.getColumnModel().getColumn(0);
		col.setPreferredWidth(100);

		col = table.getColumnModel().getColumn(1);
		col.setPreferredWidth(400);
		
		col = table.getColumnModel().getColumn(2);
		col.setPreferredWidth(150);

		scrollPane = new JScrollPane(table);
		//scrollPane.setHorizontalScrollBarPolicy(31);
		scrollPane.setPreferredSize(new Dimension(652, 0));
	}

	private void initWidgets() {
		lblTitel = new JLabel("Parameter Station 2");
		lblTitel.setFont(Schriften.fontTitel);
	}

	private void addWidgets() {
		add("North", lblTitel);

		add("West", scrollPane);
	}
}